﻿<Window x:Class="AlbumArtOrganizer.UI.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:AlbumArtOrganizer.UI"
        xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
        Title="Album Art Organizer" Height="600" Width="800" MinHeight="320" MinWidth="640" Icon="/AlbumArtOrganizer.UI;component/Images/icon.png">
    <Window.TaskbarItemInfo>
        <TaskbarItemInfo />
    </Window.TaskbarItemInfo>
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="ResourceDictionary.xaml" />
                <ResourceDictionary>
                    <local:OptionDataTemplateSelector x:Key="datatemplateSelectorOption" />
                    <CollectionViewSource x:Key="collectionViewSourceAlbums">
                        <CollectionViewSource.GroupDescriptions>
                            <PropertyGroupDescription PropertyName="Artist" />
                        </CollectionViewSource.GroupDescriptions>
                        <CollectionViewSource.SortDescriptions>
                            <componentModel:SortDescription PropertyName="Artist.Name" Direction="Ascending" />
                            <componentModel:SortDescription PropertyName="ReleaseDateString" Direction="Ascending" />
                            <componentModel:SortDescription PropertyName="Title" Direction="Ascending" />
                        </CollectionViewSource.SortDescriptions>
                    </CollectionViewSource>
                    <CollectionViewSource x:Key="collectionViewSourceImagesFound" />
                    <DataTemplate x:Key="datatemplateOptionString" DataType="AlbumArtOrganizer.Model.OptionString">
                        <StackPanel>
                            <TextBlock>
                                <Run Text="{Binding Path=Title, Mode=OneWay}" />:
                            </TextBlock>
                            <TextBox Text="{Binding Path=Value}" MinWidth="80" />
                        </StackPanel>
                    </DataTemplate>
                    <DataTemplate x:Key="datatemplateOptionDirectory" DataType="AlbumArtOrganizer.Model.OptionDirectory">
                        <StackPanel>
                            <TextBlock>
                                <Run Text="{Binding Path=Title, Mode=OneWay}" />:
                            </TextBlock>
                            <StackPanel Orientation="Horizontal">
                                <TextBox Text="{Binding Path=Value}" MinWidth="80" />
                                <Button Name="buttonOptionDirectory" Click="ButtonOptionDirectoryClick">Browse...</Button>
                            </StackPanel>
                        </StackPanel>
                    </DataTemplate>
                    <DataTemplate x:Key="datatemplateOptionEnumeration" DataType="AlbumArtOrganizer.Model.OptionEnumeration">
                        <StackPanel>
                            <TextBlock>
                                <Run Text="{Binding Path=Title, Mode=OneWay}" />:
                            </TextBlock>
                            <ComboBox ItemsSource="{Binding Path=AllowedValues}" SelectedValue="{Binding Path=Value, Mode=TwoWay}" MinWidth="80" />
                        </StackPanel>
                    </DataTemplate>
                    <DataTemplate x:Key="detailTemplateCover" DataType="AlbumArtOrganizer.Model.IAlbum">
                        <StackPanel>
                            <Border BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" 
                                    BorderThickness="1" 
                                    Margin="10">
                                <Image Name="imageCover" 
                                       Height="180" 
                                       Stretch="Uniform" 
                                       Source="{StaticResource imageNotAvailable}">
                                    <Image.CommandBindings>
                                        <CommandBinding Command="{x:Static local:MainWindow.ImageClickRoutedCommand}" 
                                                        Executed="ImageCoverClick" 
                                                        CanExecute="ImageCoverCanExecute" />
                                    </Image.CommandBindings>
                                    <Image.InputBindings>
                                        <MouseBinding MouseAction="LeftClick" Command="{x:Static local:MainWindow.ImageClickRoutedCommand}" />
                                    </Image.InputBindings>
                                </Image>
                            </Border>
                            <TextBlock Name="textblockImageDetails" HorizontalAlignment="Center" Visibility="Collapsed">
                                <Run Text="{Binding CoverImage.PixelWidth, Mode=OneWay}" />x<Run Text="{Binding CoverImage.PixelHeight, Mode=OneWay}" />
                            </TextBlock>
                        </StackPanel>
                        <DataTemplate.Triggers>
                            <DataTrigger Binding="{Binding Path=CoverImage.Exists}" Value="false">
                                <Setter TargetName="imageCover" Property="Source" Value="{StaticResource imageNotAvailable}"/>
                                <Setter TargetName="textblockImageDetails" Property="Visibility" Value="Collapsed" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Path=CoverImage.Exists}" Value="true">
                                <Setter TargetName="imageCover" Property="Source" Value="{Binding Path=CoverImage.Image}"/>
                                <Setter TargetName="textblockImageDetails" Property="Visibility" Value="Visible" />
                            </DataTrigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>
                    <DataTemplate x:Key="detailTemplate" DataType="AlbumArtOrganizer.Model.IAlbum">
                        <StackPanel Orientation="Horizontal" x:Name="stackPanelDetails">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <Grid.Resources>
                                    <Style x:Key="styleName" TargetType="TextBlock">
                                        <Setter Property="FontWeight" Value="Bold" />
                                        <Setter Property="HorizontalAlignment" Value="Right" />
                                        <Setter Property="VerticalAlignment" Value="Center" />
                                    </Style>
                                    <Style x:Key="styleValue" TargetType="TextBlock">
                                        <Setter Property="VerticalAlignment" Value="Center" />
                                        <Setter Property="Margin" Value="10,0,0,0" />
                                    </Style>
                                </Grid.Resources>
                                <TextBlock Grid.Column="0" Grid.Row="0" Style="{StaticResource styleName}">Artist:</TextBlock>
                                <TextBlock Grid.Column="1" Grid.Row="0" Style="{StaticResource styleValue}" Text="{Binding Path=Artist.Name, Mode=OneWay}" />
                                <TextBlock Grid.Column="0" Grid.Row="1" Style="{StaticResource styleName}">Album:</TextBlock>
                                <TextBlock Grid.Column="1" Grid.Row="1" Style="{StaticResource styleValue}" Text="{Binding Path=Title, Mode=OneWay}" />
                                <TextBlock Grid.Column="0" Grid.Row="2" Style="{StaticResource styleName}">Date:</TextBlock>
                                <TextBlock Grid.Column="1" Grid.Row="2" Style="{StaticResource styleValue}" Text="{Binding Path=ReleaseDateString, Mode=OneWay}" />
                            </Grid>
                        </StackPanel>
                    </DataTemplate>
                    <DataTemplate x:Key="datatemplateSelected">
                        <StackPanel>
                            <TextBlock Name="textblockArtist">
                                <Run Text="{Binding Path=Name.Name}" />
                                <Run Text="(" /><Run Text="{Binding Path=ItemCount, Mode=OneWay}" /><Run Text=")" />
                            </TextBlock>
                            <ItemsControl Name="itemscontrolAlbums" 
                                          Margin="10" ItemsSource="{Binding Path=Items}" 
                                          HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <DockPanel HorizontalAlignment="Stretch">
                                            <Border BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" 
                                                    BorderThickness="1"
                                                    Margin="3">
                                                <Image Name="imageCoverThumbnail" Width="100" Source="{Binding Path=CoverImage.ThumbnailImage, Mode=OneWay}" />
                                            </Border>
                                            <Button Name="buttonLinkAlbum" 
                                                    Click="ButtonLinkAlbumClick" 
                                                    Content="{Binding Path=Title}" 
                                                    HorizontalAlignment="Stretch" 
                                                    HorizontalContentAlignment="Stretch">
                                                <Button.Style>
                                                    <Style TargetType="Button">
                                                        <Setter Property="FocusVisualStyle">
                                                            <Setter.Value>
                                                                <Style>
                                                                    <Setter Property="Control.Template">
                                                                        <Setter.Value>
                                                                            <ControlTemplate>
                                                                                <Border>
                                                                                    <Rectangle Margin="2" StrokeThickness="1" Stroke="#60000000" StrokeDashArray="1 2"/>
                                                                                </Border>
                                                                            </ControlTemplate>
                                                                        </Setter.Value>
                                                                    </Setter>
                                                                </Style>
                                                            </Setter.Value>
                                                        </Setter>
                                                        <Setter Property="OverridesDefaultStyle" Value="true"/>
                                                        <Setter Property="Template">
                                                            <Setter.Value>
                                                                <ControlTemplate TargetType="Button">
                                                                    <Border x:Name="Border" Padding="10" CornerRadius="5" BorderThickness="1" Background="Transparent" BorderBrush="Transparent">
                                                                        <ContentPresenter Name="content" Margin="2" HorizontalAlignment="Stretch" VerticalAlignment="Center"  />
                                                                    </Border>
                                                                    <ControlTemplate.Triggers>
                                                                        <Trigger Property="IsMouseOver" Value="true">
                                                                            <Setter TargetName="Border" Property="Background">
                                                                                <Setter.Value>
                                                                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" Opacity="0.5">
                                                                                        <GradientBrush.GradientStops>
                                                                                            <GradientStopCollection>
                                                                                                <GradientStop Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" Offset="0.0"/>
                                                                                                <GradientStop Color="{DynamicResource {x:Static SystemColors.HotTrackColorKey}}" Offset="0.1"/>
                                                                                                <GradientStop Color="{DynamicResource {x:Static SystemColors.HotTrackColorKey}}" Offset="0.9"/>
                                                                                                <GradientStop Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" Offset="1.0"/>
                                                                                            </GradientStopCollection>
                                                                                        </GradientBrush.GradientStops>
                                                                                    </LinearGradientBrush>
                                                                                </Setter.Value>
                                                                            </Setter>
                                                                            <Setter TargetName="Border" Property="BitmapEffect">
                                                                                <Setter.Value>
                                                                                    <DropShadowBitmapEffect Color="{DynamicResource {x:Static SystemColors.GradientActiveCaptionColorKey}}" ShadowDepth="3" Opacity="0.5" />
                                                                                </Setter.Value>
                                                                            </Setter>
                                                                            <Setter TargetName="content" Property="TextBlock.BitmapEffect">
                                                                                <Setter.Value>
                                                                                    <OuterGlowBitmapEffect GlowColor="{DynamicResource {x:Static SystemColors.ControlLightLightColorKey}}" GlowSize="10" Noise="0" Opacity="0.5" />
                                                                                </Setter.Value>
                                                                            </Setter>
                                                                        </Trigger>
                                                                    </ControlTemplate.Triggers>
                                                                </ControlTemplate>
                                                            </Setter.Value>
                                                        </Setter>
                                                    </Style>
                                                </Button.Style>
                                            </Button>
                                        </DockPanel>
                                        <DataTemplate.Triggers>
                                            <DataTrigger Binding="{Binding Path=CoverImage.Exists}" Value="false">
                                                <Setter TargetName="imageCoverThumbnail" Property="Source" Value="{StaticResource imageNotAvailable}"/>
                                            </DataTrigger>
                                        </DataTemplate.Triggers>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>
                        </StackPanel>
                        <DataTemplate.Triggers>
                            <DataTrigger Binding="{Binding Path=Name.IsSelected}" Value="True">
                                <Setter TargetName="itemscontrolAlbums" Property="Visibility" Value="Visible" />
                                <Setter TargetName="textblockArtist" Property="FontWeight" Value="Bold" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Path=Name.IsSelected}" Value="False">
                                <Setter TargetName="itemscontrolAlbums" Property="Visibility" Value="Collapsed" />
                            </DataTrigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>
                    <Style x:Key="listViewArtistsContainerStyle" TargetType="{x:Type ListViewItem}">
                        <Setter Property="OverridesDefaultStyle" Value="true"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListViewItem}">
                                    <Border Name="border" 
                                            BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
                                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                          x:Name="PART_Content"
                                                          Content="{TemplateBinding Content}"
                                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                                          ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                                          ContentSource="Content" />
                                    </Border>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsSelected" Value="True">
                                            <Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" />
                                            <Setter TargetName="border" Property="TextBlock.Foreground" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionTextBrushKey}}" />
                                            <Setter TargetName="border" Property="Background" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}" />
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                        <Setter Property="IsSelected" Value="{Binding Path=Name.IsSelected}" />
                        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                    </Style>
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <DockPanel Name="dockpanelMain">
            <StatusBar DockPanel.Dock="Bottom" Name="statusbarAlbumScanner" Visibility="Visible">
                <StatusBarItem>
                    <TextBlock Name="textblockAlbumScannerStatus" />
                </StatusBarItem>
                <StatusBarItem>
                    <Separator/>
                </StatusBarItem>
                <StatusBarItem HorizontalAlignment="Right">
                    <ProgressBar Name="progressbarAlbumScanner" MinWidth="150" MinHeight="20" />
                </StatusBarItem>
            </StatusBar>
            <Grid Name="gridMain">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" MinWidth="100" Name="gridcolumndefinitionLeft" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <DockPanel Grid.Column="0" Grid.Row="0">
                    <ComboBox Name="comboboxAlbumScanner" 
                              DockPanel.Dock="Top"
                              TextSearch.TextPath="Name"
                              IsEditable="True"
                              IsReadOnly="True">
                        <ComboBox.ItemTemplate>
                            <DataTemplate DataType="AlbumArtOrganizer.AlbumScanner.IAlbumScannerFactory">
                                <TextBlock Text="{Binding Path=Name}" />
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>
                    <ListBox Name="listboxAlbumScannerOptions" 
                             DockPanel.Dock="Top"
                             BorderThickness="0"
                             ItemsSource="{Binding ElementName=comboboxAlbumScanner, Path=SelectedItem.Options}"
                             ItemTemplateSelector="{StaticResource datatemplateSelectorOption}">
                    </ListBox>
                    <Button Name="buttonAlbumScanner" 
                        DockPanel.Dock="Top"
                        Click="ButtonAlbumScannerClick" >Scan for Albums</Button>
                    <CheckBox Name="checkboxHideAllWithCoverArt" 
                          DockPanel.Dock="Bottom"
                          Checked="CheckboxHideAllWithCoverArtChecked"
                          Unchecked="CheckboxHideAllWithCoverArtUnchecked">Hide all with cover art</CheckBox>
                    <ListView Name="listviewArtists" 
                          VirtualizingStackPanel.IsVirtualizing="True" 
                          ItemTemplate="{StaticResource datatemplateSelected}"
                          ItemsSource="{Binding Source={StaticResource collectionViewSourceAlbums}, Path=Groups}" 
                          ItemContainerStyle="{StaticResource listViewArtistsContainerStyle}"
                          ScrollViewer.CanContentScroll="False" />
                </DockPanel>
                <GridSplitter Grid.Column="1" Grid.Row="0" 
                              Background="{DynamicResource {x:Static SystemColors.AppWorkspaceBrushKey}}"
                              HorizontalAlignment="Center"
                              VerticalAlignment="Stretch"
                              ResizeBehavior="PreviousAndNext"
                              ShowsPreview="True"
                              Width="3"
                              Margin="3,0,3,0" />
                <DockPanel Grid.Column="2" Grid.Row="0">
                    <Slider Name="sizeSlider" 
                        DockPanel.Dock="Bottom"
                        Orientation="Horizontal" Value="150" IsSnapToTickEnabled="True" 
                        Minimum="50" Maximum="400" TickPlacement="BottomRight" TickFrequency="10" 
                        AutoToolTipPrecision="0" AutoToolTipPlacement="BottomRight"
                        IsDirectionReversed="False" IsMoveToPointEnabled="False" />
                    <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                        <ContentControl x:Name="contentcontrolCover"
                                    ContentTemplate="{StaticResource detailTemplateCover}">
                            <ContentControl.Content>
                                <Binding ElementName="treeviewAlbums" Path="SelectedItem" />
                            </ContentControl.Content>
                        </ContentControl>
                        <StackPanel Margin="10">
                            <ContentControl ContentTemplate="{StaticResource detailTemplate}" x:Name="contentcontrol">
                                <ContentControl.Content>
                                    <Binding ElementName="treeviewAlbums" Path="SelectedItem" />
                                </ContentControl.Content>
                            </ContentControl>
                            <ListBox Name="listboxImageFinderOptionGroups"
                                     ItemContainerStyle="{StaticResource listBoxWithoutSelectionContainerStyle}">
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Horizontal" />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel>
                                            <TextBlock FontWeight="Bold" Text="{Binding Path=Name}" />
                                            <ListBox Name="listboxImageFinderOptions" 
                                                     BorderThickness="0"
                                                     ItemTemplateSelector="{StaticResource datatemplateSelectorOption}"
                                                     ItemsSource="{Binding Path=Options}"
                                                     ItemContainerStyle="{StaticResource listBoxWithoutSelectionContainerStyle}">
                                                <ListBox.ItemsPanel>
                                                    <ItemsPanelTemplate>
                                                        <StackPanel />
                                                    </ItemsPanelTemplate>
                                                </ListBox.ItemsPanel>
                                            </ListBox>
                                            <Button Name="buttonSearch" 
                                                    VerticalAlignment="Center" 
                                                    HorizontalAlignment="Left" 
                                                    Click="ButtonSearchClick" 
                                                    Margin="0,10,0,0"
                                                    IsEnabled="{Binding Path=IsSearchAvailable}">Search</Button>
                                        </StackPanel>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </StackPanel>
                    </StackPanel>
                    <!--TextBox Name="textboxSearchResults" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True" /-->
                    <ListBox Name="listboxSearchResults" 
                             Margin="10,10,10,10" 
                             ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                             ItemsSource="{Binding Source={StaticResource collectionViewSourceImagesFound}}">
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="{x:Type ListBoxItem}">
                                <Setter Property="OverridesDefaultStyle" Value="true"/>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                              x:Name="PART_Content"
                                              Content="{TemplateBinding Content}"
                                              ContentTemplate="{TemplateBinding ContentTemplate}"
                                              ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                              ContentSource="Content" />
                                            <ControlTemplate.Triggers>
                                                <Trigger Property="IsSelected" Value="True">
                                                    <Setter TargetName="PART_Content" Property="TextBlock.Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
                                                    <Setter Property="Background" Value="Transparent" />
                                                </Trigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="IsSelected" Value="{Binding Path=Name.IsSelected}" />
                                <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                            </Style>
                        </ListBox.ItemContainerStyle>
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <WrapPanel/>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <DataTemplate.Resources>
                                    <Style TargetType="{x:Type Viewbox}">
                                        <Setter Property="HorizontalAlignment" Value="Stretch"/>
                                        <Setter Property="VerticalAlignment" Value="Stretch"/>
                                        <Setter Property="Width" Value="{Binding Path=Value, ElementName=sizeSlider, Mode=TwoWay}"/>
                                        <Setter Property="Height" Value="{Binding Path=Value, ElementName=sizeSlider, Mode=TwoWay}"/>
                                    </Style>
                                    <Style TargetType="{x:Type Hyperlink}">
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}" />
                                            </Trigger>
                                        </Style.Triggers>
                                        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
                                    </Style>
                                </DataTemplate.Resources>
                                <StackPanel Margin="10">
                                    <Viewbox>
                                        <Border BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" DockPanel.Dock="Top" Margin="10">
                                            <Image Name="imageCover" Stretch="Uniform" Source="{Binding Path=ThumbnailImage}">
                                                <Image.CommandBindings>
                                                    <CommandBinding Command="{x:Static local:MainWindow.ImageClickRoutedCommand}" 
                                                        Executed="ImageCoverClick" 
                                                        CanExecute="ImageCoverCanExecute" />
                                                </Image.CommandBindings>
                                                <Image.InputBindings>
                                                    <MouseBinding MouseAction="LeftClick" Command="{x:Static local:MainWindow.ImageClickRoutedCommand}" />
                                                </Image.InputBindings>
                                            </Image>
                                        </Border>
                                    </Viewbox>
                                    <TextBlock HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="12">
                                        <Run Text="{Binding Path=FullSizeWidth}" />x<Run Text="{Binding Path=FullSizeHeight}" />
                                    </TextBlock>
                                    <TextBlock HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="12">
                                        <Hyperlink Name="hyperlinkSaveImage" Click="HyperlinkSaveImageClick">Save</Hyperlink> | 
                                        <Hyperlink Name="hyperlinkOpenInBrowser" Click="HyperlinkOpenInBrowserClick">Open in browser</Hyperlink>
                                    </TextBlock>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </DockPanel>
            </Grid>
        </DockPanel>
        <Border Name="borderOverlay" Background="#AA000000" Visibility="Collapsed" Padding="40">
            <Grid>
                <DockPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                    <Button Name="buttonCloseOverlay" 
                            DockPanel.Dock="Bottom"
                            Margin="0,20,0,0"
                            MaxWidth="{Binding ElementName=imageOverlay, Path=ActualWidth}"
                            Width="{Binding ElementName=imageOverlay, Path=ActualWidth}"
                            MinWidth="100"
                            Click="ButtonCloseOverlayClick">Close</Button>
                    <Border BorderBrush="Black" BorderThickness="2">
                        <Image Name="imageOverlay" />
                    </Border>
                </DockPanel>
            </Grid>
        </Border>
    </Grid>
</Window>
